from multiprocessing import Process, Pool
import os
import time
class Myprocess(Process):
	def __init__(self, wTime):
		Process.__init__(self)
		self.wTime = wTime
	def run(self):
		n = 0
		while n < 3:
			print("subProcess %s run," % os.getpid(), "{0}".format(time.ctime()))
			time.sleep(self.wTime)
			n += 1
if __name__ == "__main__":
	p = Myprocess(2)
	p.daemon = True
	p.start()	#自动调用run方法
	p.join()
	print("Parent process run. subProcess is ", p.pid)
	print("Parent process end,{0}".format(time.ctime()))
